<template>
    <div class="box">
      <div class="nav">
        <router-link to="/mine">
          <img src="../../assets/lyl/image/tuijian/BMQD-1.png" alt="">
        </router-link>
        <span>全部订单</span>
        <span>编辑</span>
      </div>
      <ul class="ulone" ref="content">
        <li @click="qie(index)" :class="{active:$route.params.id==index}" v-for="(item,index) in data">
          <router-link :to="item.to">
            <span>{{item.txt}}<span v-if="$route.params.id==index" class="xiahua"></span></span>
          </router-link>
        </li>
      </ul>
      <router-view></router-view>
    </div>
</template>

<script>
    export default {
      name: "Alloders",
      data(){
        return {
          data:[
            {to:'/alldingdan/0',txt:'全部订单'},
            {to:'/daizhifu/1',txt:'待支付'},
            {to:'/daifahuo/2',txt:'待发货'},
            {to:'/daishouhuo/3',txt:'待收货'},
            {to:'/jywc/4',txt:'交易完成'}
          ]
        }
      },
      methods:{
        qie(i){
          if (i==4) {
            this.$refs.content.scrollLeft += 200;
          }
          if (i==0) {
            this.$refs.content.scrollLeft -= 200;
          }
        }
      }
    }
</script>

<style scoped>
  .box{
    background: #f2f2f2;
  }
  .nav{
    padding: 2rem;
    background: #e53e42;
    display: flex;
    justify-content: space-between;
  }
  .nav span{
    color: #fff;
    font-size: 36px;
  }
  .nav span:nth-child(3){
    font-size: 30px;
  }
  .ulone{
    background: #fff;
    display: flex;
    overflow-x: scroll;
    padding: 2rem 0;
    border-bottom: 1px solid #ccc;
  }
  .ulone li{
    position: relative;
    flex-shrink: 0;
    text-align: center;
    margin: 0 4rem;
    font-size: 30px;
  }
  .ulone .active span{
    color:#e53e42;
  }
  .ulone li .xiahua{
    position: absolute;
    bottom: -2rem;
    border-bottom: 1px solid red;
    display: block;
    width: 100%;
  }
</style>
